from learn import db, Video, LeadingActor

v = Video(name="我们的七日战争", time=1576166400000, director="村野佑太",
          content="动画版的故事设定在2020年，讲述了某学校中学一年级的男学生们，集体在废弃工厂建立所谓的“解放区”，并发动了针对大人们的“叛乱”后的故事，借此反映了学生学业过重、学校对学生任意进行体罚等种种社会问题。",
          url="https://www.iqiyi.com/v_19rwzq6lpc.html", img_url="https://rpg.pic-imges.com/pic/upload/vod/2020-03/1585121440.jpg")
db.session.add(v)
db.session.commit()
l0 = LeadingActor(name="芳根京子", video_id=v.id)
l1 = LeadingActor(name="北村匠海", video_id=v.id)
l2 = LeadingActor(name="宫泽理惠", video_id=v.id)
db.session.add_all([l0, l1, l2])
db.session.commit()

v = Video(name="海绵宝宝：营救大冒险", time=1596729600000, director="蒂姆·希尔",
          content="《海绵宝宝：营救大冒险》讲述了海绵宝宝心爱的宠物小蜗被绑架后，海绵宝宝和派大星前往失落的大西洋城展开营救冒险的故事。在这场充满危险又妙趣横生的营救行动中，海绵宝宝和他的朋友们用实际行动证明了友谊的力量无限大！",
          url="https://www.iqiyi.com/v_xguhfh4wbc.html", img_url="https://pic8.iqiyipic.com/image/20201110/3e/13/v_153820316_m_601_m8_284_160.jpg")
db.session.add(v)
db.session.commit()
l0 = LeadingActor(name="陈浩", adorn="海绵宝宝", video_id=v.id)
l1 = LeadingActor(name="冯盛", adorn="派大星", video_id=v.id)
l2 = LeadingActor(name="张遥函", adorn="蟹老板", video_id=v.id)
l3 = LeadingActor(name="罗杰·布帕斯", adorn="章鱼哥", video_id=v.id)
db.session.add_all([l0, l1, l2, l3])
db.session.commit()

v = Video(name="喜羊羊与灰太狼之羊年喜羊羊", time=1422633600000, director="黄伟明 黄晓雪",
          content="在阳光明媚的日子里，灰太狼突然闯入羊村，虽然他被小羊羊们击退，却把村长的变身魔毯打劫回去。表现英勇的喜羊羊受到伙伴们的称赞，而懒羊羊对此反而有些愤愤不平。为了证明自己的实力，他将慢羊羊的时空照相机错认为手枪...",
          url="https://www.iqiyi.com/v_19rro068hw.html", img_url="https://pic5.iqiyipic.com/image/20200908/cb/0c/v_108987737_m_601_m5_284_160.jpg")
db.session.add(v)
db.session.commit()
l0 = LeadingActor(name="祖晴", adorn="喜羊羊", video_id=v.id)
l1 = LeadingActor(name="梁颖", adorn="懒羊羊", video_id=v.id)
l2 = LeadingActor(name=" 张琳", adorn="灰太狼", video_id=v.id)
db.session.add_all([l0, l1, l2])
db.session.commit()

v = Video(name="神秘世界历险记3", time=1469721600000, director="王云飞",
          content="一只古老的面具打破了神秘世界族民们的平静的生活，一场不可避免的战争即将爆发！为阻止这场战争，新族长啦啦请人类世界的好友王雨果回来帮忙，淘气的雨果却将爸爸王大山带入了神秘世界。面对周遭突如其来的变化和对未知的恐惧... ",
          url="https://www.iqiyi.com/v_19rrm53j5s.html", img_url="https://pic8.iqiyipic.com/image/20201120/f0/77/v_110901746_m_601_m7_284_160.jpg")
db.session.add(v)
db.session.commit()
l0 = LeadingActor(name="刘校妤", adorn="王雨果", video_id=v.id)
l1 = LeadingActor(name="孟泉霖", adorn="啦啦", video_id=v.id)
l2 = LeadingActor(name="陆揆", adorn="熊大叔", video_id=v.id)
l3 = LeadingActor(name="宝木中阳", adorn="王大山", video_id=v.id)
l4 = LeadingActor(name="白雪岑", adorn="兰", video_id=v.id)
db.session.add_all([l0, l1, l2, l3, l4])
db.session.commit()

v = Video(name="姜子牙", time=1601481600000, director="程腾 李炜（导）",
          content="故事发生于封神大战后。姜子牙率领众神伐纣，赢得封神大战胜利，以为可以唤回世间安宁。然而，一切并未结束。一个偶然，姜子牙发现了原来“封神大战”之下酝酿着更大的阴谋。姜子牙开始踏上探寻真相的旅途......",
          url="https://www.iqiyi.com/v_19rrp0pmb0.html", img_url="https://pic2.iqiyipic.com/image/20201118/0a/73/v_134762233_m_601_m21_284_160.jpg")
db.session.add(v)
db.session.commit()
l0 = LeadingActor(name="郑希", adorn="姜子牙", video_id=v.id)
db.session.add_all([l0])
db.session.commit()

v = Video(name="猫和老鼠大电影", time=743961600000, director="菲尔·罗曼",
          content="萝苹原以为自己是位孤儿，受不了姑婆的虐待逃离家里。一心前往与父亲的小木屋在街上流浪遇到一对毛和老鼠汤姆和杰瑞患难见真情.他们从原来的排诉到后来的携手合作帮萝苹找到了父亲。",
          url="https://www.iqiyi.com/v_wt09ivfhbg.html", img_url="https://pic6.iqiyipic.com/image/20201231/50/ba/v_156095249_m_601_m1_284_160.jpg")
db.session.add(v)
db.session.commit()
l0 = LeadingActor(name="格雷格·伯森", video_id=v.id)
l1 = LeadingActor(name="Tino Insana", video_id=v.id)
db.session.add_all([l0, l1])
db.session.commit()

v = Video(name="天气之子", time=1572537600000, director="新海诚",
          content="高一那年夏天，帆高离开位在离岛的家乡，独自一人来到东京，拮据的生活迫使他不得不找份工作，最后来到一间专门出版奇怪超自然刊物的出版社担任写手。不久，东京开始下起连日大雨，仿佛暗示着帆高不顺遂的未来...",
          url="https://www.iqiyi.com/v_19rueobmj8.html", img_url="https://pic6.iqiyipic.com/image/20200907/31/5f/v_137512673_m_601_m14_284_160.jpg")
db.session.add(v)
db.session.commit()
l0 = LeadingActor(name="森七菜", adorn="天野阳菜", video_id=v.id)
l1 = LeadingActor(name="本田翼", adorn="须贺夏美", video_id=v.id)
db.session.add_all([l0, l1])
db.session.commit()

v = Video(name="风语咒", time=1533225600000, director=" 刘阔",
          content="生活在孝阳岗的少年郎明怀揣侠岚梦想，但双眼失明的他却只能靠招摇撞骗混于市井之中。直到有一天，罗刹袭击孝阳岗，与他相依为命的母亲突然失踪，郎明迫不得已踏上了找寻真相之路。一波未平一波又起...",
          url="https://www.iqiyi.com/v_19rrcsuqyw.html", img_url="https://pic3.iqiyipic.com/image/20200904/cf/c1/v_115720703_m_601_m17_284_160.jpg")
db.session.add(v)
db.session.commit()
l0 = LeadingActor(name="路知行", adorn="朗明", video_id=v.id)
db.session.add_all([l0])
db.session.commit()

v = Video(name="白蛇：缘起", time=1547136000000, director="赵霁（导演） 黄家康",
          content="晚唐年间，国师发动民众大量捕蛇。前去刺杀国师的白蛇意外失忆，被捕蛇村少年救下。为帮助少女找回记忆，两人踏上了一段冒险旅程。冒险的过程让两人感情迅速升温，但少女蛇妖的身份也逐渐显露...",
          url="https://www.iqiyi.com/v_19rr575vxk.html", img_url="https://pic8.iqiyipic.com/image/20200908/7d/45/v_119183912_m_601_m23_284_160.jpg")
db.session.add(v)
db.session.commit()
l0 = LeadingActor(name="杨天翔", adorn="阿宣", video_id=v.id)
l1 = LeadingActor(name="张喆", adorn="小白", video_id=v.id)
l2 = LeadingActor(name="张遥函", adorn="国师", video_id=v.id)
db.session.add_all([l0, l1, l2])
db.session.commit()

v = Video(name="昨日青空", time=1540483200000, director="奚超",
          content="中国首部青春题材动画电影《昨日青空》将于2018年暑期全国上映。该片改编自口袋巧克力同名人气漫画作品，由咕咚导演奚超执导。影片以中国南方小镇兰溪为实际取景地，讲述了小镇上的几位高三学生，有关梦想、友谊、亲情和初恋...",
          url="https://www.iqiyi.com/v_19rrdurjo8.html", img_url="https://pic3.iqiyipic.com/image/20200906/02/f2/v_113866654_m_601_m19_284_160.jpg")
db.session.add(v)
db.session.commit()
l0 = LeadingActor(name="苏尚卿", adorn="屠小意", video_id=v.id)
l1 = LeadingActor(name="王一博", adorn="齐景轩", video_id=v.id)
l2 = LeadingActor(name="段艺璇", adorn="姚哲恬", video_id=v.id)
db.session.add_all([l0, l1, l2])
db.session.commit()

v = Video(name="西行纪之再见悟空", time=1588521600000, director="钟沐龙",
          content="改编自动漫IP《西行纪》，天界公主素衣在凡间与孙悟空结识，情投意合。但悟空却被其他天神当成凡间妖物暴力对待，镇压在了五指山下。三百年来，如来大神用行动感化悟空，教会悟空如何坚守心中正义...",
          url="https://v.qq.com/x/cover/mzc002007g7aqqt.html", img_url="https://puui.qpic.cn/vcover_hz_pic/0/mzc002007g7aqqt1587699881031/0")
db.session.add(v)
db.session.commit()

v = Video(name="哪吒之魔童降世", time=1564070400000, director="饺子",
          content="天地灵气孕育出一颗能量巨大的混元珠，元始天尊将混元珠提炼成灵珠和魔丸，灵珠投胎为人，助周伐纣时可堪大用；而魔丸则会诞出魔王，为祸人间...",
          url="https://v.qq.com/x/cover/zr5a67l333ehzu9.html", img_url="https://i.gtimg.cn/qqlive/img/jpgcache/files/qqvideo/hori/z/zr5a67l333ehzu9_big.jpg")
db.session.add(v)
db.session.commit()
l0 = LeadingActor(name="瀚墨", adorn="敖丙", video_id=v.id)
l1 = LeadingActor(name="囧森瑟夫", adorn="哪吒", video_id=v.id)
db.session.add_all([l0, l1])
db.session.commit()

v = Video(name="声之形", time=1504800000000, director="山田尚子",
          content="西宫硝子生来患有听觉障碍，要依靠助听器和外界交流，口语发音也因此格外的古怪。特殊的生理缺陷让她成为了班上引人注目的独特存在，她因此收获了坚实的友情，却也遭到了以男生石田将也为首的小团体的孤立和排挤。",
          url="https://www.iqiyi.com/v_19rrdx0s04.html", img_url="https://pic9.iqiyipic.com/image/20200902/77/d6/v_113660328_m_601_m5_284_160.jpg")
db.session.add(v)
db.session.commit()
l0 = LeadingActor(name="入野自由", adorn="石田将也", video_id=v.id)
l1 = LeadingActor(name="早见沙织", adorn=" 西宫硝子", video_id=v.id)
db.session.add_all([l0, l1])
db.session.commit()

v = Video(name="我想吃掉你的胰脏", time=1547740800000, director="牛岛新一郎",
          content="“没有名字的我，没有未来的她”对他人毫无兴趣，总是独自一人读书的高中生“我”。这样的“我”有一天，偶然捡到一册写着《共病文库》的文库本。那是，天真烂漫的班上人气王·山内樱良私下记录的日记本。里面记载着她身患胰脏的疾病...",
          url="https://www.iqiyi.com/v_19rr2sv940.html", img_url="https://pic9.iqiyipic.com/image/20200906/7c/9e/v_120487383_m_601_m15_284_160.jpg")
db.session.add(v)
db.session.commit()
l0 = LeadingActor(name="Lynn", adorn="山内樱良", video_id=v.id)
l1 = LeadingActor(name="高杉真宙", adorn="“我”", video_id=v.id)
db.session.add_all([l0, l1])
db.session.commit()

v = Video(name="肆式青春", time=1533312000000, director="李豪凌 易小星 竹内良贵",
          content="影片由李豪凌、易小星、竹内良贵三人联合执导,以三段温暖清新的小故事共同组成，从“衣食住行”四个方面来诉说关于青春的故事。",
          url="https://www.iqiyi.com/v_19rrc6xoro.html", img_url="https://pic2.iqiyipic.com/image/20200905/22/d7/v_115579599_m_601_m16_284_160.jpg")
db.session.add(v)
db.session.commit()
l0 = LeadingActor(name="梁达伟", adorn="李墨", video_id=v.id)
l1 = LeadingActor(name="唐雅菁", adorn="夏小雨", video_id=v.id)
db.session.add_all([l0, l1])
db.session.commit()

# 删
# 查
# # get 根据id查询
# vdo = Video.query.get(1)
# print(vdo.name)
#
# all 查询全部
vdo = Video.query.all()
for i in vdo:
    print(i.name)

# # filter 条件查询
# vdo = Video.query.filter(Video.id <= 2)
# for i in vdo:
#     print(i.name, i.id)
# # filter_by
# vdo = Video.query.filter_by(name="海绵宝宝：营救大冒险").all()
# for i in vdo:
#     print(i.name, i.name, i.director)
# 改
# video = Video.query.filter(Video.id == 1).delete()
# db.session.commit()
